import React, {Component} from 'react';
import {Switch, Route, Redirect} from 'react-router-dom';
import Sudoku from './Sudoku';
import Gobang from './Gobang';
import CanvasImpact from './ElasticBall';

class GamesRouter extends Component {
    render() {
        const prefix = this.props.match.path;
        return(
            <Switch>
                <Route path={`${prefix}/suduko`} component={Sudoku}/>
                <Route path={`${prefix}/gobang`} component={Gobang}/>
                <Route path={`${prefix}/ball`} component={CanvasImpact}/>
                <Redirect from={`${prefix}`} to={`${prefix}/suduko`} />
            </Switch>
        );
    };
}

export default GamesRouter;